home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Reference Guide
/
C-C++ Interactive Reference Guide.iso
/
c_ref
/
csource4
/
225_01
/
deff4.txt
< prev
next >
Wrap
Text File
|
1987-06-10
|
11KB
|
328 lines
DEFF4.TXT
---------
I have given, below, a description of each of the functions
which I have written for the file -
DEFF4.C
and which may be accessed through -
DEFF4(.CRL)
when you use the CLINK function with BDS C. It is
necessary to specify "DEFF4" on the command line when using
the included functions. If you put it first, say -
clink filename deff4 {other options} <RETURN>
then you will always get the DEFF4 functions included in the
COM file in preference to any other functions of the same name
which might be elsewhere in your files.
If you intend to use DEFF4 in this way then it should be on
the same disk as the BDS C DEFF files. Now, the functions
I have written and what they do are -
BRIGHT ENTAB GO_TO HAZ_CLEAR
LINE LINES LISTD LISTS
LOWER_STR MAKE_FCB NORMAL OUT_CHAR
PEC_CLEAR PRINT_U PRT_HEX SET_BIT
UP_STR VIDEO_CHAR B_TEST
The special BIOS functions are -
CONIN CONOUT CONST LIST_C
LISTST READ_SEC SELDSK SET_DMA
SET_SEC SET_TRK W_BOOT WRITE_SEC
void BRIGHT()
-------------
Makes the display appear in high-intensity, for the Hazeltine
Esprit terminal.
char B_TEST(byte, bit)
int bit;
char byte;
---------------------
Tests the byte to see whether the nominated bit is set or not.
Returns TRUE if bit set else returns FALSE. Note the bits
are numbered from ZERO (0) to SEVEN (7).
char CONIN()
------------
Returns the next character from the console, with the parity
bit ( = bit 7) set to zero.
void CONOUT(c)
char c;
--------------
Prints the ASCII character to the console.
char CONST()
------------
Returns the console status as -
0 if no character is waiting
0xff if a character is waiting
char ENTAB(n)
int n;
-------------
This can only be used when the position "n" along the line
(generally of up to 80 characters and ALWAYS terminated with
the RETURN character) is known. So you have to maintain
(external to this function) a count of where you are along
the line, and pass this value to TAB.
TAB will then expand any "tab" characters ( = 0x09) into the
correct number of spaces, so long as you are using a tab
which is set to 8 spaces. If you want to change this to any
other tab spacing, then go into DEFF4 and change the equate.
Note particularly this was written for use with printers
which don't recognise the tab character. I believe a lot
of the older printers are of this type.
void GO_TO(column, row)
int column, row;
-----------------------
Will send the cursor to the nominated address where#-
column = 0 to 79 (for 80 characters)
row = 0 to 23 (for 24 lines)
for the Hazeltine terminals. Note the function could
easily be altered for other terminals provided the lead-in
codes are known.
void HAZ_CLEAR()
----------------
Will clear the screen and home cursor for the Hazeltine Esprit
terminal.
char INKEY()
------------
Duplicates the Microsoft Basic "inkey" function in that it will
return TRUE/FALSE depending on whether a key has been pressed
or not. Note it doesn't display the key which was pressed.
Must be used in a loop to function properly. For example -
while(inkey() == FALSE)
; /* Empty loop */
void LINE()
-----------
Will space down one line on the console screen.
void LINES(n)
unsigned n;
-------------
Will space down the number of lines nominated by the user.
void LISTC(c)
char c;
-------------
Sends the ASCII character to the line printer.
void LISTD(i)
int i;
-------------
Will print an integer as a decimal number on the list device
which is typically the line printer.
void LISTS(str)
char *str;
---------------
Will list a null-terminated string on the list device which is
typically the line printer.
char LISTST()
-------------
Checks to see whether the line printer (the list device) is on
line and returns 0xff if the printer is ready to accept a
character else returns 0 if the printer is busy or is off line.
void LOWER_STR(str)
char *str;
-------------------
Will convert a null-terminated string, in place, to lower
case characters.
void MAKE_FCB(name, fcb)
char name[15], fcb[36];
------------------------
Will create a CP/M file control block with the file name
correctly parsed for use with other functions such as
OPEN_FILE, CREATE_FILE, etc which are to be found in DEFF3.
Note: I didn't do anything to set the drive code (which is
---- character fcb[0], so this will be zero unless you
specifically set it to something after using the
"make_fcb" function. It is easy enough to include
the drive specifier in the function, if you wish to
do this yourself as an exercise.
void NORMAL()
-------------
Returns the screen display to normal viewing intensity, for
the Hazeltine Esprit terminal.
void OUT_CHAR(c)
int c;
----------------
Sends the nominated character to the terminal after first
limiting it to no more than 7 bits. i.e. the parity bit is
removed prior to transmission.
Uses the "bios" function to send the character.
void PEC_CLEAR()
----------------
Clears the terminal screen without having to know the special
terminal functions. Note does NOT home the cursor.
void PRINT_U(n)
unsigned n;
---------------
Will print the unsigned integer, in decimal format, to the
console screen.
void READ_SEC()
---------------
Reads the 128-byte sector into the DMA buffer. Note the
sector must have been previously specified with calls to
SET_TRK and SET_SEC and the DMA buffer must have been
specified with SET_DMA. Returns 0 if the read was OK else
returns 1 for an unspecified read error.
int SELDSK(drive)
char drive;
-----------------
Selects the nominated disk (A, B,.....F) as the "logical" disk
for the next disk operation. Will return 0 if drive refers
to a non-existent drive.
void SET_BIT(fcb, mode)
char fcb[36], mode[3];
-----------------------
This is the function used in BACKUP to change the attribute
bits in the name given in the file control block. Mode has
to be one of -
R/O Read Only
R/W Read/Write
DIR Appears in directory when listed
SYS Doesn't appear in directory
ARC Has already been archived by BACKUP
CPY Not yet archived
void SET_DMA(buffer)
char *buffer;
--------------------
Sets the DMA buffer address at the address given by the
buffer pointer. This buffer is then used in all later
disk I/O operations.
void SET_SEC(sector_number)
int sector_number;
---------------------------
This is the sector number used in direct track addressing
and can hold any value from 0 to 255. For the address to
be valid you must have first used the SET_TRK function to
set the absolute track number.
void SET_TRK(track_number)
int track_number;
--------------------------
This is the (absolute) track number used in direct disk track
addressing operations. Note the disk must first have been
pre-selected with the SELDSK function. Acceptable track
numbers are from 0 to 65,535 (0x00 to 0xffff).
void UP-STR(str)
char *str;
----------------
Will convert a null-terminated string to upper case ASCII
characters, in place.
void W_BOOT()
-------------
Performs the normal CP/M "warm boot" function.
char WRT_SEC()
--------------
Writes out to disk the sector nominated in SELDSK, SET_TRK
and SET_SEC and as contained in the DMA buffer. Will
return zero for a successful write else returns 1 for an
unspecified write error.
void VIDEO_CHAR(c, attr)
char c, attr;
------------------------
Prints to the console the character nominated in the video
mode stipulated by the user. At present the mode is
restricted to -
'B' - Bright
'N' - Normal
Note the function is specific to Hazeltine terminals because
it uses (internally) the functions "BRIGHT" and "NORMAL"
which have been written for the Hazeltine terminals. If it
is required to transport the function to another terminal
then it will be necessary to make BRIGHT and NORMAL specific
to that terminal.
in all later
disk I/O operations.
void SET_SE